package com.zhuoyue.web.controller;

import com.zhuoyue.common.aop.auth.CheckLogin;
import com.zhuoyue.common.dto.ControllerResult;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author wjming
 * 产品分类
 */
@RestController
@Scope("prototype")
@RequestMapping("/api/product")
@Validated
public class AppProductController {

    @Value("${rest-template.prod}")
    private String prodUrl;

    @GetMapping("/get")
    @CheckLogin
    public ControllerResult getProduct() {
        RestTemplate restTemplate = new RestTemplate();
        String url = "http://" + prodUrl + "/prod/manage/get";
        ResponseEntity<Object> forEntity = restTemplate.getForEntity(url, Object.class);
        Object body = forEntity.getBody();
        return ControllerResult.toReturnDataSuccess("成功", body);
    }






}



